#import "WFCrop.h"

@implementation WFCrop

+ (NSDictionary<NSString *,id> *)modelCustomPropertyMapper {
    return @{
             @"id" : @[@"id", @"cropId"],
             @"name" : @[@"name", @"cropName"],
             @"phases" : @[@"phases", @"time"],
             };
}

- (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic {
    NSDictionary *phaseDic = dic[@"time"];
    if (!self.phases && phaseDic) {
        WFIdNamePair *pair = [[WFIdNamePair alloc] init];
        pair.id = phaseDic[@"timeId"];
        pair.name = phaseDic[@"timeName"];
        self.phases = @[pair];
    }
    return YES;
}

+ (NSDictionary<NSString *,id> *)modelContainerPropertyGenericClass {
    return @{
             @"phases" : [WFIdNamePair class],
             };
}

@end
